package com.transaction.demo.base.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.transaction.demo.common.util.Result;
import com.transaction.demo.common.util.ResultPage;
import com.transaction.demo.base.vo.req.SysDictItemListReqVo;
import com.transaction.demo.base.vo.req.SysDictItemAddReqVo;
import com.transaction.demo.base.vo.req.SysDictItemUpdateReqVo;
import com.transaction.demo.base.vo.resp.SysDictItemRespVo;
import com.transaction.demo.base.service.SysDictItemService;

/**
 * 描述：字典数据表
 * 作者：马庆智
 * 日期：2023/03/28 17:07:14
 */
@Api(tags = "字典数据表")
@RestController
@RequestMapping("/sysDictItem")
public class SysDictItemController {

	@Autowired
	private SysDictItemService sysDictItemService;

	/**
	 * 查询字典数据表列表
	 *
	 * @param record 请求参数
	 * @return SysDictItemResp
	 * @author 马庆智
	 * @date: 2023/03/28 17:07:14
	 */
	@ApiOperation("查询字典数据表列表")
	@PostMapping("/querySysDictItemList")
	public Result<ResultPage<SysDictItemRespVo>> querySysDictItemList(@RequestBody @Valid SysDictItemListReqVo record) {
		return Result.success(sysDictItemService.querySysDictItemList(record));
	}

	/**
	 * 添加字典数据表
	 *
	 * @param record 请求参数
	 * @return Result<Integer>
	 * @author 马庆智
	 * @date: 2023/03/28 17:07:14
	 */
	@ApiOperation("添加字典数据表")
	@PostMapping("/saveSysDictItem")
	public Result<Integer> saveSysDictItem(@RequestBody @Valid SysDictItemAddReqVo record) {
		return Result.success(sysDictItemService.saveSysDictItem(record));
	}

	/**
	 * 删除字典数据表
	 *
	 * @param ids 请求参数
	 * @return Result<Integer>
	 * @author 马庆智
	 * @date: 2023/03/28 17:07:14
	 */
	@ApiOperation("删除字典数据表")
	@GetMapping("/deleteSysDictItem")
	public Result<Integer> deleteSysDictItem(String ids) {
		return Result.success(sysDictItemService.deleteSysDictItem(ids));
	}

	/**
	 * 更新字典数据表
	 *
	 * @param record 请求参数
	 * @return Result<Integer>
	 * @author 马庆智
	 * @date: 2023/03/28 17:07:14
	 */
	@ApiOperation("更新字典数据表")
	@PostMapping("/updateSysDictItem")
	public Result<Integer> updateSysDictItem(@RequestBody @Valid SysDictItemUpdateReqVo record) {
		return Result.success(sysDictItemService.updateSysDictItem(record));
	}

}